package my.multithreadtest;

public class SimpleThread extends Thread{
	
	protected int  countDown=150;
	protected final int threadId; 
	private static int threadCount=0;
	public SimpleThread(){
		super("" + ++threadCount);
		threadId=threadCount;
		start();
	}
	@Override
	public String toString(){
		return "#" + getName() + ": " + countDown + " " + System.nanoTime();
	}
	
	public void run(){
		while(true){
//			System.out.println(this);
			VisualDbg.synprint(threadId);
//			VisualDbg.print();
			
//			System.out.print(threadId);
			if(--countDown == 0) return;
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) throws InterruptedException{
		// TODO Auto-generated method stub
		for(int i=0;i<5;i++)
			new SimpleThread();
	}

}
